package com.mew.user.controller;

import com.mew.common.entity.user.User;
import com.mew.common.rest.invite.InviteUserResponseMessage;
import com.mew.user.service.InviteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @author dylin
 * @create 2021/3/31
 */
@Controller
@RequestMapping("/invite")
public class InviteController {
    @Autowired
    private InviteService inviteService;

    @PostMapping("/bind_inviter")
    @ResponseBody
    public int bindInviter(@RequestParam("uid")long uid,@RequestParam("inv") String inv){
        return inviteService.bindInviter(uid,inv);
    }
    @GetMapping("/invite_user_list")
    @ResponseBody
    public InviteUserResponseMessage getInviteUserList(@RequestParam("userId")long userId){
        return InviteUserResponseMessage.builder()
                    .inviteUserList(inviteService.getInviteUserList(userId))
                    .build();
    }
}
